package com.initialize.service.system.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.initialize.common.tool.md5.MD5;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @program: star-blockchain
 * @description: MD5控制器  --  便于调试
 * @author: Mr.Jane
 * @create: 2019-09-23 18:23
 **/
@Api(tags = "MD5测试")
@CrossOrigin
@RestController
@RequestMapping(value = "/md5")
public class MD5Controller {


    @ApiOperation(value = "获取一个测试的Md5")
    @GetMapping(value = "/test-md5")
    public String getMd5(@RequestBody Map<String, Object> map) throws JsonProcessingException {

        ObjectMapper mapper = new ObjectMapper();
        String s = mapper.writeValueAsString(map);
        return MD5.md5(s);
    }
}
